Purpose:: Note that for each graph requested and presented, this is simply where I stopped messing with them. Most have them have one or more things about them that can be improved, so if you like the output of one but not aspects of styling it will be most time-efficient to focus on improving those (rather than try to perfect every one before showing where I’m at)

Inverted Faces

RT for all answered questions (accurate and inaccurate)

re=xyplot(logRT_mean~Session, groups=Subject, subset=Direction=="Up", Inv_stats_bysub_bydirection_bytime, type=c('p','l'),
          par.settings=ggplot2like(),axis=axis.grid, ylab="Upright Response Time", auto.key = TRUE)
re

Inverted Spaghetti Plot

ra=xyplot(logRT_mean~Session, groups=Subject, subset=Direction=="Inv", Inv_stats_bysub_bydirection_bytime, type=c('p','l'),
          par.settings=ggplot2like(),axis=axis.grid, ylab="Inverted Response Time", auto.key = TRUE, pch=24)
ra

ra+re

I haven’t figured out how to extend the x axis yet or add a key specifying that triangle is Inverted and circle is upright

Spaghetti plot line for each subject and Direction in panels

#Spaghetti plot line for each subject and Direction in panels
xyplot(logRT_mean~Session|Direction, groups=Subject, Inv_stats_bysub_bydirection_bytime, type=c('p','l'), par.settings=ggplot2like(),axis=axis.grid, ylab="Response Time", auto.key = list(space="right"), layout=c(2,1), main="Response Time by Subject")

Spaghetti plot line each sub in same panel

#try Spaghetti plot line each sub in same panel
try.pch=c(22, 16)
try.fill=c("orange", "skyblue", "lightgreen", "purple", "red")
(tryplot=with(Inv_stats_bysub_bydirection_bytime,
             xyplot(logRT_mean~Session,
                    panel=function(x,y,...,subscripts) {
                      pch=try.pch[Direction[subscripts]]
                      fill=try.fill[Subject[subscripts]]
                      panel.xyplot(x,y,pch=pch, fill=fill, col=fill, type ='p', cex=1.25)
                    },
                    key=list(space="right", text=list(levels(Direction)), points=list(pch=try.pch, col="black", cex=1.5), 
                             text=list(levels(Subject)), points=list(pch=16, col=try.fill),
                             rep=FALSE), axis=axis.grid, ylab="Response Time", main="Response Time by Subject")))

Each subject separately

#plot Subject 1
xyplot(logRT_mean~Session, groups=Direction, subset=Subject=="1", Inv_stats, type=c('p','l'), par.settings=ggplot2like(),axis=axis.grid, ylab="Mean RT Subject 1", auto.key = TRUE)

#plot Sub 2
xyplot(logRT_mean~Session, groups=Direction, subset=Subject=="2", Inv_stats, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, ylab="Mean RT Subject 2", auto.key = TRUE)

#plot Sub 3
xyplot(logRT_mean~Session, groups=Direction, subset=Subject=="3", Inv_stats, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, ylab="Mean RT Subject 3", auto.key = TRUE)

#Plot Sub 4
xyplot(logRT_mean~Session, groups=Direction, subset=Subject=="4", Inv_stats, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, ylab="Mean RT Subject 4", auto.key = TRUE)

#Plot Sub 5
xyplot(logRT_mean~Session, groups=Direction, subset=Subject=="5", Inv_stats, type=c('p', 'l'), par.settings=ggplot2like(),axis=axis.grid, ylab="Mean RT Subject 5", auto.key = TRUE)

#Plot Overall Spaghetti
xyplot(logRT_mean~Session, groups=Direction, subset=Subject=="Overall", Inv_stats, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, ylab="Overall RT", auto.key = TRUE) 

#Can't the colors correct below, doesn't look nice
xyplot(logRT_mean~Session, groups=c(Direction), Inv_stats, type=c('p','l'),
                       par.settings=ggplot2like(),axis=axis.grid, ylab="Response Time", main="All Subjects & Overall", auto.key = list(space="right", title="Key", cex.title=1.5))

Colors not separating subject key doesn’t dileniate by subject

Subject Response Times

mypanel=function(x,y,h, k){
     panel.xyplot(x, y, lty=1, type=c('p', 'l'))
     panel.lmline(x, y, lty=3, lwd=1, col="purple")
     panel.grid(h=-1, v=-1)
     panel.abline(mean(h), lty=2, col="red")
     llines(x, y, col=c("blue", "green"))
}
#xyplot(logRT_mean~Session|sidebyside, groups=Direction, data=Inv_stats_bysub_bydirection_bytime,  h=Inv_stats_bysub_bydirection_bytime$logRT_mean, layout=c(5,1), aspect=1.5, main="Subject Response Times Inv v Up", xlab="RT (ms)", ylab="Session", panel=mypanel, auto.key = list(space="top"))
colors=c("blue", "green")
keylist=list(space="top", col=c("blue", "green", "red", "purple"), 
             columns=1, text=c("Inv", "Up", "Mean", "Regression"))
bysubject=factor(Inv_stats$Subject, levels = c(1,2,3,4,5), 
                 labels = c("1", "2", "3", "4", "5"))
xyplot(logRT_mean~Session|bysubject, groups=Direction, data=Inv_stats, 
                h=Inv_stats$logRT_mean, layout=c(5,1), aspect=1.5, 
                main="Subject Response Times Inv v Up", xlab="RT (ms)", 
                ylab="Session", panel=mypanel, auto.key=keylist)

Response Times Over Time

#Time 1
ggplot(data=Invtime1_time2_LONG, subset=c(Subject=="50142" & Session=="1", aes(logRT~Trial) +geom_line()))

levels(T1Plots$Subject)
## [1] "50142" "50192" "50202" "50262" "50312"
xyplot(logRT~Trial, groups=Direction, subset=Subject=="50142", data=T1Plots, type='l', ylim = (3:10), main="Subject1, Session 1 RT", auto.key = list(space="top"))

xyplot(logRT~Trial, groups=Direction, subset=Subject=="50192", data=T1Plots, type='l', ylim = (3:10), main="Subject2, Session 1 RT", auto.key = list(space="top"))

xyplot(logRT~Trial, groups=Direction, subset=Subject=="50202", data=T1Plots, type='l', ylim = (3:10), main="Subject2, Session 1 RT", auto.key = list(space="top"))

xyplot(logRT~Trial, groups=Direction, subset=Subject=="50262", data=T1Plots, type='l', ylim = (3:10), main="Subject2, Session 1 RT", auto.key = list(space="top"))

xyplot(logRT~Trial, groups=Direction, subset=Subject=="50312", data=T1Plots, type='l', ylim = (3:10), main="Subject2, Session 1 RT", auto.key = list(space="top"))

xyplot(logRT~Trial, groups=Subject, data=T1Plots, type="a", ylim=(3:10), main="Session 1 Response Times by Subject", auto.key = list(space='top'))

#i don't understand why the lines don't overlap

#Time 2
xyplot(logRT~Trial, groups=Direction, subset=Subject=="50142", data=T2Plots, type='l', ylim = (3:10), main="Subject1, Session 2 RT", auto.key = list(space="top"))

xyplot(logRT~Trial, groups=Direction, subset=Subject=="50192", data=T2Plots, type='l', ylim = (3:10), main="Subject2, Session 2 RT", auto.key = list(space="top"))

xyplot(logRT~Trial, groups=Direction, subset=Subject=="50202", data=T2Plots, type='l', ylim = (3:10), main="Subject2, Session 2 RT", auto.key = list(space="top"))

xyplot(logRT~Trial, groups=Direction, subset=Subject=="50262", data=T2Plots, type='l', ylim = (3:10), main="Subject2, Session 2 RT", auto.key = list(space="top"))

xyplot(logRT~Trial, groups=Direction, subset=Subject=="50312", data=T2Plots, type='l', ylim = (3:10), main="Subject2, Session 2 RT", auto.key = list(space="top"))

xyplot(logRT~Trial, groups=Subject, data=T1Plots, type="a", ylim=(3:10), main="Session 2 Response Times by Subject", auto.key = list(space='top'))

The Following graphs reprint the above (Inverted Faces Response Times), using ONLY Accurate response times

By Subject and Direction

#Spaghetti plot line for each subject and Direction
xyplot(logRT_mean~Session, groups=c(Subject, Direction), Inv_2_sub_dir_time, type='l',
       par.settings=ggplot2like(),axis=axis.grid, ylab="Response Time")

Comparing accurate to inaccurate RT

#Spaghetti plot line for each subject, Inaccurate RT
xyplot(logRT~Session, group=Subject, subset=Comparison.ACC==0, Invtime1_time2_LONG, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, ylab="Response Time, Incorrect Responses")

xyplot(logRT~Session, group=Comparison.ACC, Invtime1_time2_LONG, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, ylab="Response Time")

note that there were very few inaccurate but responded to questions (red)

Accuracy Analysis, Inverted Faces (responded questions only)

#Upright Spaghetti Plot
xyplot(Comparison.ACC_mean~Session, groups=Subject, subset=Direction=="Up", Inv_stats_bysub_bydirection_bytime, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, ylab="Upright Accuracy")

#Inverted Spaghetti Plot
xyplot(Comparison.ACC_mean~Session, groups=Subject, subset=Direction=="Inv", Inv_stats_bysub_bydirection_bytime, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, ylab="Inverted Accuracy")

#Spaghetti plot line for each subject and Direction
xyplot(Comparison.ACC_mean~Session, groups=c(Subject, Direction), Inv_stats_bysub_bydirection_bytime, type=c('p','l'), par.settings=ggplot2like(),axis=axis.grid, ylab="Accuracy")

#plot Subject 1
xyplot(Comparison.ACC_mean~Session, groups=Direction, subset=Subject=="1", Inv_stats, type=c('p','l'), par.settings=ggplot2like(),axis=axis.grid, ylab="Mean ACC Subject 1")

#plot Sub 2
xyplot(Comparison.ACC_mean~Session, groups=Direction, subset=Subject=="2", Inv_stats, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, ylab="Mean ACC Subject 2")

#plot Sub 3
xyplot(Comparison.ACC_mean~Session, groups=Direction, subset=Subject=="3", Inv_stats, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, ylab="Mean ACC Subject 3")

#Plot Sub 4
xyplot(Comparison.ACC_mean~Session, groups=Direction, subset=Subject=="4", Inv_stats, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, ylab="Mean ACC Subject 4")

#Plot Sub 5
xyplot(Comparison.ACC_mean~Session, groups=Direction, subset=Subject=="5", Inv_stats, type=c('p', 'l'), par.settings=ggplot2like(),axis=axis.grid, ylab="Mean RT Subject 5")

#Plot Overall Spaghetti
xyplot(Comparison.ACC_mean~Session, groups=Direction, subset=Subject=="Overall", Inv_stats, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, ylab="Overall ACC") 

xyplot(Comparison.ACC_mean~Session, groups=c(Direction), Inv_stats, type=c('p','l'),
       par.settings=ggplot2like(),axis=axis.grid, ylab="Overall ACC", main="Subject 5 & Overall", auto.key = list(space="right", title="Key", cex.title=1.5))

#Inv_stats_bysub_bydirection_bytime$tmpSubject=as.numeric(Inv_stats_bysub_bydirection_bytime$Subject)
#sidebyside=equal.count(Inv_stats_bysub_bydirection_bytime$tmpSubject, number=5, overlap=0)
mypanel=function(x,y,h, k){
  panel.xyplot(x, y, lty=1, type=c('p', 'l'))
  panel.lmline(x, y, lty=3, lwd=1, col="purple")
  panel.grid(h=-1, v=-1)
  panel.abline(mean(h), lty=2, col="red")
  llines(x, y, col=c("blue", "green"))
}
#xyplot(Comparison.ACC~Session|sidebyside, groups=Direction, data=Inv_stats_bysub_bydirection_bytime,  h=Inv_stats_bysub_bydirection_bytime$logRT_mean, layout=c(5,1), aspect=1.5, main="Subject ACC Inv v Up", xlab="RT (ms)", ylab="Session", panel=mypanel, auto.key = list(space="top"))

colors=c("blue", "green")
keylist=list(space="top", col=c("blue", "green", "red", "purple"), columns=1, text=c("Inv", "Up", "Mean", "Regression"))
bysubject=factor(Inv_stats$Subject, levels = c(1,2,3,4,5), labels = c("1", "2", "3", "4", "5"))
xyplot(Comparison.ACC_mean~Session|bysubject, groups=Direction, data=Inv_stats, 
       h=Inv_stats$Comparison.ACC_mean, layout=c(5,1), aspect=1.5, 
       main="Subject Accuracy Inv v Up", xlab="Session", 
       ylab="Proportion Accurate Responses", panel=mypanel, auto.key=keylist)

#plot each person's ACC Over time
#Time 1
xyplot(Comparison.ACC~Trial, groups=Direction, subset=Subject=="50142", data=T1Plots, type='l', main="Subject1, Session 1 ACC", auto.key = list(space="top"))

xyplot(Comparison.ACC~Trial, groups=Direction, subset=Subject=="50192", data=T1Plots, type='l', main="Subject2, Session 1 ACC", auto.key = list(space="top"))

xyplot(Comparison.ACC~Trial, groups=Direction, subset=Subject=="50202", data=T1Plots, type='l', main="Subject2, Session 1 ACC", auto.key = list(space="top"))

xyplot(Comparison.ACC~Trial, groups=Direction, subset=Subject=="50262", data=T1Plots, type='l', main="Subject2, Session 1 ACC", auto.key = list(space="top"))

xyplot(Comparison.ACC~Trial, groups=Direction, subset=Subject=="50312", data=T1Plots, type='l', main="Subject2, Session 1 ACC", auto.key = list(space="top"))

xyplot(Comparison.ACC~Trial, groups=Subject, data=T1Plots, type="a", main="Session 1 Accuracy by Subject", auto.key = list(space='top'))

#Time 2
xyplot(Comparison.ACC~Trial, groups=Direction, subset=Subject=="50142", data=T2Plots, type='l', main="Subject1, Session 2 ACC", auto.key = list(space="top"))

xyplot(Comparison.ACC~Trial, groups=Direction, subset=Subject=="50192", data=T2Plots, type='l', main="Subject2, Session 2 ACC", auto.key = list(space="top"))

xyplot(Comparison.ACC~Trial, groups=Direction, subset=Subject=="50202", data=T2Plots, type='l', main="Subject2, Session 2 ACC", auto.key = list(space="top"))

xyplot(Comparison.ACC~Trial, groups=Direction, subset=Subject=="50262", data=T2Plots, type='l', main="Subject2, Session 2 ACC", auto.key = list(space="top"))

xyplot(Comparison.ACC~Trial, groups=Direction, subset=Subject=="50312", data=T2Plots, type='l', main="Subject2, Session 2 ACC", auto.key = list(space="top"))

xyplot(Comparison.ACC~Trial, groups=Subject, data=T1Plots, type="a", main="Session 2 Accuracy by Subject", auto.key = list(space='top'))